<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>Private Cloud: F:/cvs/projects/rd1/taiping/Cloud/PrivateCloud.h 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Private Cloud
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="annotated.html"><span>类</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('_private_cloud_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>全部</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>类</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>函数</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>变量</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>类型定义</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">PrivateCloud.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;﻿#pragma once</div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;</div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#include &quot;CloudMsg.h&quot;</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &lt;map&gt;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &lt;list&gt;</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &lt;afxmt.h&gt;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;</div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#define HEARTBEAT_INTERVAL                  (30 * 1000)</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#define CloudCallbackReason_Recv            0</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define CloudCallbackReason_Send            1</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define CloudCallbackReason_Error           101</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define CloudCallbackReason_LoginError      102</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define CloudCallbackReason_CloudError      1001</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="keyword">typedef</span> BOOL (WINAPI *LPCLOUD_CALLBACK)(DWORD dwReason, LPVOID lpBuffer, DWORD_PTR lpContext);</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div>
<div class="line"><a name="l00019"></a><span class="lineno"><a class="code" href="class_c_private_cloud_helper.html">   19</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_c_private_cloud_helper.html">CPrivateCloudHelper</a></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;{</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00023"></a><span class="lineno"><a class="code" href="struct_c_private_cloud_helper_1_1___c_a_l_l_b_a_c_k___i_t_e_m.html">   23</a></span>&#160;    <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_c_private_cloud_helper_1_1___c_a_l_l_b_a_c_k___i_t_e_m.html" title="该结构是回调函数的参数之一。">_CALLBACK_ITEM</a></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;    {</div>
<div class="line"><a name="l00025"></a><span class="lineno"><a class="code" href="struct_c_private_cloud_helper_1_1___c_a_l_l_b_a_c_k___i_t_e_m.html#adc09397fa0bba48253c3ea3993ef11fe">   25</a></span>&#160;        <span class="keywordtype">long</span> <a class="code" href="struct_c_private_cloud_helper_1_1___c_a_l_l_b_a_c_k___i_t_e_m.html#adc09397fa0bba48253c3ea3993ef11fe">peer_ip</a>;           </div>
<div class="line"><a name="l00026"></a><span class="lineno"><a class="code" href="struct_c_private_cloud_helper_1_1___c_a_l_l_b_a_c_k___i_t_e_m.html#ae22ec328514a7c2d8354b77b757f3e33">   26</a></span>&#160;        <a class="code" href="struct___c_l_o_u_d_m_s_g___h_d_r.html" title="通信消息头。">LPCLOUDMSG_HDR</a> <a class="code" href="struct_c_private_cloud_helper_1_1___c_a_l_l_b_a_c_k___i_t_e_m.html#ae22ec328514a7c2d8354b77b757f3e33">hdr</a>;     </div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    } <a class="code" href="class_c_private_cloud_helper.html#ab558ff594fe00f0cd37a5f70bd6b106a" title="该结构是回调函数的参数之一。">CALLBACK_ITEM</a>, *<a class="code" href="struct_c_private_cloud_helper_1_1___c_a_l_l_b_a_c_k___i_t_e_m.html" title="该结构是回调函数的参数之一。">LPCALLBACK_ITEM</a>;</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <a class="code" href="class_c_private_cloud_helper.html">CPrivateCloudHelper</a>();</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;    ~<a class="code" href="class_c_private_cloud_helper.html">CPrivateCloudHelper</a>();</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    VOID <a class="code" href="class_c_private_cloud_helper.html#aa6f7a8ccc64fd6e6ca6f1913060e0300">RegisterCallback</a>(LPCLOUD_CALLBACK lpCallbackRoutine, DWORD_PTR lpContext);</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    DWORD <a class="code" href="class_c_private_cloud_helper.html#a735751efa08e4a19a6b0ddf06b67bbcb">BeginSearch</a>(LPCTSTR lpszCloudId = NULL);</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;    VOID <a class="code" href="class_c_private_cloud_helper.html#ac36eb064a3bfda161547f4dc58238b98">EndSearch</a>();</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <span class="keyword">static</span> BOOL <a class="code" href="class_c_private_cloud_helper.html#ab1e055235527df889918005963321ef6">GenerateToken</a>(IN LPTSTR lpszTokenMask, IN LPTSTR lpszTokenMask2, IN LPTSTR lpszPassword, OUT LPBYTE lpToken);</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    <span class="keyword">static</span> BOOL <a class="code" href="class_c_private_cloud_helper.html#a4991d19e1e362d6ae6c689bb6b3a9494">GenerateRandomTokenMask</a>(OUT LPTSTR lpszTokenMask);</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="class_c_private_cloud_helper.html#afea9573ee6a91c04a6750c9f208830e2">CRC</a>(<span class="keywordtype">char</span> *p, <span class="keywordtype">int</span> length);</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <span class="keyword">static</span> VOID <a class="code" href="class_c_private_cloud_helper.html#ab6851aec57762f1178e6605d7193e8e9">Package</a>(<a class="code" href="struct___c_l_o_u_d_m_s_g___h_d_r.html" title="通信消息头。">LPCLOUDMSG_HDR</a> hdr);</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    <span class="keyword">static</span> BOOL <a class="code" href="class_c_private_cloud_helper.html#acff100df85cb78f344ebb25b9581244e">Verify</a>(<a class="code" href="struct___c_l_o_u_d_m_s_g___h_d_r.html" title="通信消息头。">LPCLOUDMSG_HDR</a> hdr);</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    <span class="keyword">static</span> BOOL <a class="code" href="class_c_private_cloud_helper.html#ad03e3b632c32be2549fb6a5596ca2026">VerifyHeader</a>(<a class="code" href="struct___c_l_o_u_d_m_s_g___h_d_r.html" title="通信消息头。">LPCLOUDMSG_HDR</a> hdr);</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    <span class="keyword">static</span> DWORD WINAPI SearchThread(LPVOID lpContext);</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    HANDLE m_hThread;</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    SOCKET m_hSocket;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    LPCLOUD_CALLBACK m_lpCallbackRoutine;</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    DWORD_PTR m_lpCallbackContext;</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    TCHAR m_szCloudId[CLOUD_ID_LENGTH];</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;};</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;</div>
<div class="line"><a name="l00128"></a><span class="lineno"><a class="code" href="class_c_private_cloud.html">  128</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_c_private_cloud.html">CPrivateCloud</a></div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;{</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    <span class="keyword">typedef</span> <span class="keyword">struct </span>_PRIVATECLOUD_ITEM</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;    {</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;        <span class="keywordtype">long</span> ip;                                </div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;        HANDLE hServerThread;                   </div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;        HANDLE hClientThread;                   </div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;        SOCKET hServerSocket;                   </div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;        SOCKET hClientSocket;                   </div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;        BOOL bDeviceInformationOK;              </div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;        WCHAR szDeviceId[DEVICE_ID_LENGTH];     </div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;        WCHAR szDeviceName[DEVICE_NAME_LENGTH]; </div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;        WCHAR szDeviceType[DEVICE_TYPE_LENGTH]; </div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;        std::list&lt;LPCLOUDMSG_HDR&gt; cTaskList;    </div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;        HANDLE hEvent;                          </div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;        BOOL bTerminated;                       </div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;        BOOL bConnected;                        </div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    } PRIVATECLOUD_ITEM, *LPPRIVATECLOUD_ITEM;</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;    <span class="keyword">typedef</span> <span class="keyword">struct </span>_CONNECT_CONTEXT</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;    {</div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;        <a class="code" href="class_c_private_cloud.html">CPrivateCloud</a> *pCloud;              </div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;        BOOL bRunAsServer;                  </div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;        <span class="keywordtype">long</span> ip;                            </div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;    } CONNECT_CONTEXT, *LPCONNECT_CONTEXT;</div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00158"></a><span class="lineno"><a class="code" href="struct_c_private_cloud_1_1___c_a_l_l_b_a_c_k___i_t_e_m.html">  158</a></span>&#160;    <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct_c_private_cloud_1_1___c_a_l_l_b_a_c_k___i_t_e_m.html" title="该结构用来给调用者注册的回调函数传递参数。">_CALLBACK_ITEM</a></div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;    {</div>
<div class="line"><a name="l00160"></a><span class="lineno"><a class="code" href="struct_c_private_cloud_1_1___c_a_l_l_b_a_c_k___i_t_e_m.html#ae347a48027f758f40c91e7e898c59e6e">  160</a></span>&#160;        <span class="keywordtype">long</span> <a class="code" href="struct_c_private_cloud_1_1___c_a_l_l_b_a_c_k___i_t_e_m.html#ae347a48027f758f40c91e7e898c59e6e">peer_ip</a>;                       </div>
<div class="line"><a name="l00161"></a><span class="lineno"><a class="code" href="struct_c_private_cloud_1_1___c_a_l_l_b_a_c_k___i_t_e_m.html#aea74b4aec3c775be2802d37817ea7a85">  161</a></span>&#160;        DWORD_PTR <a class="code" href="struct_c_private_cloud_1_1___c_a_l_l_b_a_c_k___i_t_e_m.html#aea74b4aec3c775be2802d37817ea7a85">lpData</a>;                   </div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;    } <a class="code" href="class_c_private_cloud.html#abbf40043f92ee0c584c4b5ba4040afbc" title="该结构用来给调用者注册的回调函数传递参数。">CALLBACK_ITEM</a>, *<a class="code" href="struct_c_private_cloud_1_1___c_a_l_l_b_a_c_k___i_t_e_m.html" title="该结构用来给调用者注册的回调函数传递参数。">LPCALLBACK_ITEM</a>;</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;    <a class="code" href="class_c_private_cloud.html">CPrivateCloud</a>();</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    ~<a class="code" href="class_c_private_cloud.html">CPrivateCloud</a>();</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;    <span class="keyword">static</span> DWORD WINAPI <a class="code" href="class_c_private_cloud.html#a23cac5b8cfe05e35f4d6b7fc3af850cb">UdpListenThread</a>(LPVOID lpContext);</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;    <span class="keyword">static</span> DWORD WINAPI <a class="code" href="class_c_private_cloud.html#a2903b176ed596eae6596d91226dc7d7c">TcpListenThread</a>(LPVOID lpContext);</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;</div>
<div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;    <span class="keyword">static</span> DWORD WINAPI <a class="code" href="class_c_private_cloud.html#a5e3937dc09652ad844bea668e3ce7f60">MessageThread</a>(LPVOID lpContext);</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;    <span class="keyword">static</span> DWORD WINAPI <a class="code" href="class_c_private_cloud.html#aea9c86fcc435d166c3041eff138b3ac0">HeartbeatThread</a>(LPVOID lpContext);</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;    VOID <a class="code" href="class_c_private_cloud.html#ad50bcea5d87fcebcc6de854e33fc5aa8">SetDeviceInformation</a>(LPCTSTR lpszDeviceId, LPCTSTR lpszDeviceName, LPCTSTR lpszDeviceType);</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;    VOID <a class="code" href="class_c_private_cloud.html#a48c068e1a4a2ae6b77dbf68a68d6770f">RegisterCallback</a>(LPCLOUD_CALLBACK lpCallbackRoutine, DWORD_PTR lpContext);</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;</div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;    DWORD <a class="code" href="class_c_private_cloud.html#a1a65af4d1c471c03991e81bcb3570223">ConnectToCloud</a>(LPTSTR lpszCloudId, LPTSTR lpszCloudName, LPTSTR lpszPassword);</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;    BOOL <a class="code" href="class_c_private_cloud.html#ae1db3a91b8f848b8ab3d588118dcbee8">IsCloudConnected</a>();</div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;    DWORD <a class="code" href="class_c_private_cloud.html#aebe6162ff9278fa1d2d004eeb45c7f24">ConnectToDevice</a>(<span class="keywordtype">long</span> ip);</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;    VOID <a class="code" href="class_c_private_cloud.html#aab7746b028a7ccc162baa8400fdfaea0">DisconnectFromDevice</a>(<span class="keywordtype">long</span> ip);</div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;</div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;    VOID <a class="code" href="class_c_private_cloud.html#a25d0d17d6f72e28c1bf424350afc51ca">DisconnectAll</a>();</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;</div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;    BOOL <a class="code" href="class_c_private_cloud.html#a70d3aa11bf4a97c3f83d0d75756e8f9f">PostTask</a>(<span class="keywordtype">long</span> ip, <a class="code" href="struct___c_l_o_u_d_m_s_g___h_d_r.html" title="通信消息头。">LPCLOUDMSG_HDR</a> lpMsg);</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;</div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;    BOOL <a class="code" href="class_c_private_cloud.html#acdbc34f7b51fd0f49d5c6da6b70f48f4">Callback</a>(DWORD dwReason, <span class="keywordtype">long</span> ip, DWORD_PTR lpBuffer);</div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;</div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;    BOOL <a class="code" href="class_c_private_cloud.html#aa77a1eb114a0b67d501fd94a31be1a09">GetDeviceInformation</a>(<span class="keywordtype">long</span> ip, LPTSTR lpszDeviceId, LPTSTR lpszDeviceName, LPTSTR lpszDeviceType);</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;</div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;    BOOL <a class="code" href="class_c_private_cloud.html#a7c21b80a991cb62fea0e4ec9c7b4bed5">IsDeviceConnected</a>(<span class="keywordtype">long</span> ip);</div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;</div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160;    VOID <a class="code" href="class_c_private_cloud.html#ab52f455585c71455e3d43fb08309b995">GetConnectedDeviceList</a>(<span class="keywordtype">long</span> **pList, DWORD &amp;dwCount);</div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;</div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;    VOID <a class="code" href="class_c_private_cloud.html#acad97abcb56e45d7c390db3c640a2d48">FreeConnectedDeviceList</a>(<span class="keywordtype">long</span> *pList);</div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;</div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160;</div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;    CCriticalSection m_cs;</div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;    BOOL m_bConnected;          <span class="comment">// 是否已经连接到私有云</span></div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;</div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160;    HANDLE m_hUdpListenThread;  <span class="comment">// 监听并处理广播消息</span></div>
<div class="line"><a name="l00320"></a><span class="lineno">  320</span>&#160;    HANDLE m_hTcpListenThread;  <span class="comment">// 监听其它云设备的通信请求</span></div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;    SOCKET m_hUdpListenSocket;</div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;    SOCKET m_hTcpListenSocket;</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;    HANDLE m_hHeartbeatThread;</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160;    HANDLE m_hTerminateEvent;</div>
<div class="line"><a name="l00325"></a><span class="lineno">  325</span>&#160;    </div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160;    LPCLOUD_CALLBACK m_lpCallbackRoutine;</div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;    DWORD_PTR m_lpCallbackContext;</div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;</div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;    std::map&lt;long, PRIVATECLOUD_ITEM&gt; m_cDeviceList;</div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;</div>
<div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;</div>
<div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;    TCHAR m_szDeviceId[DEVICE_ID_LENGTH];</div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;    TCHAR m_szDeviceName[DEVICE_NAME_LENGTH];</div>
<div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;    TCHAR m_szDeviceType[DEVICE_TYPE_LENGTH];</div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;</div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;    TCHAR m_szCloudId[CLOUD_ID_LENGTH];</div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;    TCHAR m_szCloudName[CLOUD_NAME_LENGTH];</div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160;    TCHAR m_szPassword[64];</div>
<div class="line"><a name="l00340"></a><span class="lineno">  340</span>&#160;};</div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_12859e9ce2669cbca25dfb5d2f5e76b9.html">cvs</a></li><li class="navelem"><a class="el" href="dir_46c82c2a7333f2e3cd05ba1382e118cb.html">projects</a></li><li class="navelem"><a class="el" href="dir_496b4f25515139bca24a93522e02bdc4.html">rd1</a></li><li class="navelem"><a class="el" href="dir_91406594dc27817971a4ab36fb54f782.html">taiping</a></li><li class="navelem"><a class="el" href="dir_9fe168dfc1766ab55af595edd8a076c9.html">Cloud</a></li><li class="navelem"><b>PrivateCloud.h</b></li>
    <li class="footer">生成于 2013年 五月 3日 星期五 11:19:06 , 为 Private Cloud使用 
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.3.1 </li>
  </ul>
</div>
</body>
</html>
